package com.itrus.contract.extension.shardinsphere.enumeration;


import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ShardingTableEnum {


    CONTRACT(1,"ec_contract", "sharding_date","合同"),
    CONTRACT_SIGNER(3,"ec_contract_signer", "sharding_date","合同签署人表"),
    ;

    @EnumValue
    private int index;
    private String tableName;
    private String shardingColumn;
    private String description;


    public static ShardingTableEnum findByTableName(String tableName){
        return Arrays.stream(ShardingTableEnum.values()).filter(o->o.getTableName().equalsIgnoreCase(tableName)).findFirst().orElse(null);
    }

}
